﻿
Imports System.IO

Public Class form
    Inherits xhtmlControl

    Protected Overrides Function availableAttribute(ByVal key As String) As Boolean
        Return attributesCollection.common(key) OrElse _
                attributesCollection.accept(key) OrElse _
                attributesCollection.accept_charset(key) OrElse _
                attributesCollection.action(key) OrElse _
                attributesCollection.method(key) OrElse _
                attributesCollection.enctype(key) OrElse _
                attributesCollection.onreset(key) OrElse _
                attributesCollection.onsubmit(key) OrElse _
                attributesCollection.target(key) OrElse _
                attributesCollection.name(key)
    End Function

    Public Sub New(Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff, "form")
    End Sub
End Class

Public Class input
    Inherits xhtmlControl

    Protected Overrides Function availableAttribute(ByVal key As String) As Boolean
        Return attributesCollection.common(key) OrElse _
                attributesCollection.accept(key) OrElse _
                attributesCollection.accesskey(key) OrElse _
                attributesCollection.alt(key) OrElse _
                attributesCollection.checked(key) OrElse _
                attributesCollection.disabled(key) OrElse _
                attributesCollection.maxlength(key) OrElse _
                attributesCollection.name(key) OrElse _
                attributesCollection.readonly(key) OrElse _
                attributesCollection.size(key) OrElse _
                attributesCollection.src(key) OrElse _
                attributesCollection.tabindex(key) OrElse _
                attributesCollection.type(key) OrElse _
                attributesCollection.value(key) OrElse _
                attributesCollection.usemap(key) OrElse _
                attributesCollection.onblur(key) OrElse _
                attributesCollection.onchange(key) OrElse _
                attributesCollection.onfocus(key) OrElse _
                attributesCollection.onselect(key) OrElse _
                attributesCollection.onpropertychange(key)
    End Function

    Public Enum type_enum
        password
        checkbox
        button
        radio
        submit
        reset
        file
        hidden
        image
        text
    End Enum

    Public Shadows Property type() As type_enum
        Get
            If strsame(MyBase.type, "password", False) Then
                Return type_enum.password
            ElseIf strsame(MyBase.type, "checkbox", False) Then
                Return type_enum.checkbox
            ElseIf strsame(MyBase.type, "button", False) Then
                Return type_enum.button
            ElseIf strsame(MyBase.type, "radio", False) Then
                Return type_enum.radio
            ElseIf strsame(MyBase.type, "submit", False) Then
                Return type_enum.submit
            ElseIf strsame(MyBase.type, "reset", False) Then
                Return type_enum.reset
            ElseIf strsame(MyBase.type, "file", False) Then
                Return type_enum.file
            ElseIf strsame(MyBase.type, "hidden", False) Then
                Return type_enum.hidden
            ElseIf strsame(MyBase.type, "image", False) Then
                Return type_enum.image
            Else
                Return type_enum.text
            End If
        End Get
        Set(ByVal value As type_enum)
            Select Case value
                Case type_enum.password
                    MyBase.type = "password"
                Case type_enum.checkbox
                    MyBase.type = "checkbox"
                Case type_enum.button
                    MyBase.type = "button"
                Case type_enum.radio
                    MyBase.type = "radio"
                Case type_enum.submit
                    MyBase.type = "submit"
                Case type_enum.reset
                    MyBase.type = "reset"
                Case type_enum.file
                    MyBase.type = "file"
                Case type_enum.hidden
                    MyBase.type = "hidden"
                Case type_enum.image
                    MyBase.type = "image"
                Case Else
                    MyBase.type = "text"
            End Select
        End Set
    End Property

    Public Sub New(Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff, "input")
    End Sub
End Class

Public Class [select]
    Inherits xhtmlControl

    Protected Overrides Function availableAttribute(ByVal key As String) As Boolean
        Return attributesCollection.common(key) OrElse _
                attributesCollection.disabled(key) OrElse _
                attributesCollection.multiple(key) OrElse _
                attributesCollection.name(key) OrElse _
                attributesCollection.size(key) OrElse _
                attributesCollection.tabindex(key) OrElse _
                attributesCollection.onblur(key) OrElse _
                attributesCollection.onchange(key) OrElse _
                attributesCollection.onfocus(key)
    End Function

    Public Sub New(Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff, "select")
    End Sub
End Class

Public Class [option]
    Inherits xhtmlControl

    Protected Overrides Function availableAttribute(ByVal key As String) As Boolean
        Return attributesCollection.common(key) OrElse _
                attributesCollection.disabled(key) OrElse _
                attributesCollection.label(key) OrElse _
                attributesCollection.selected(key) OrElse _
                attributesCollection.value(key)
    End Function

    Public Sub New(Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff, "option")
    End Sub
End Class

Public Class textarea
    Inherits xhtmlControl

    Protected Overrides Function availableAttribute(ByVal key As String) As Boolean
        Return attributesCollection.common(key) OrElse _
                attributesCollection.accesskey(key) OrElse _
                attributesCollection.cols(key) OrElse _
                attributesCollection.disabled(key) OrElse _
                attributesCollection.name(key) OrElse _
                attributesCollection.readonly(key) OrElse _
                attributesCollection.rows(key) OrElse _
                attributesCollection.tabindex(key) OrElse _
                attributesCollection.onblur(key) OrElse _
                attributesCollection.onchange(key) OrElse _
                attributesCollection.onfocus(key) OrElse _
                attributesCollection.onselect(key)
    End Function

    Protected Overrides Function isonelineControl() As Boolean
        Return False
    End Function

    Public Sub New(Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff, "textarea")
    End Sub
End Class

Public Class button
    Inherits xhtmlControl

    Protected Overrides Function availableAttribute(ByVal key As String) As Boolean
        Return attributesCollection.common(key) OrElse _
                attributesCollection.accesskey(key) OrElse _
                attributesCollection.disabled(key) OrElse _
                attributesCollection.name(key) OrElse _
                attributesCollection.tabindex(key) OrElse _
                attributesCollection.type(key) OrElse _
                attributesCollection.value(key) OrElse _
                attributesCollection.onblur(key) OrElse _
                attributesCollection.onfocus(key)
    End Function

    Public Enum type_enum
        button
        reset
        submit
    End Enum

    Public Shadows Property type() As type_enum
        Get
            If strsame(MyBase.type, "button", False) Then
                Return type_enum.button
            ElseIf strsame(MyBase.type, "reset", False) Then
                Return type_enum.reset
            Else
                Return type_enum.submit
            End If
        End Get
        Set(ByVal value As type_enum)
            Select Case value
                Case type_enum.button
                    MyBase.type = "button"
                Case type_enum.reset
                    MyBase.type = "reset"
                Case Else
                    MyBase.type = "submit"
            End Select
        End Set
    End Property

    Public Sub New(Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff, "button")
    End Sub
End Class

Public Class fieldset
    Inherits xhtmlControl

    Protected Overrides Function availableAttribute(ByVal key As String) As Boolean
        Return attributesCollection.common(key)
    End Function

    Public Sub New(Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff, "fieldset")
    End Sub
End Class

Public Class label
    Inherits xhtmlControl

    Protected Overrides Function availableAttribute(ByVal key As String) As Boolean
        Return attributesCollection.common(key) OrElse _
                attributesCollection.accesskey(key) OrElse _
                attributesCollection.for(key) OrElse _
                attributesCollection.onblur(key) OrElse _
                attributesCollection.onfocus(key)
    End Function

    Public Sub New(Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff, "label")
    End Sub
End Class

Public Class legend
    Inherits xhtmlControl

    Protected Overrides Function availableAttribute(ByVal key As String) As Boolean
        Return attributesCollection.common(key) OrElse _
                attributesCollection.accesskey(key)
    End Function

    Public Sub New(Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff, "legend")
    End Sub
End Class

Public Class optgroup
    Inherits xhtmlControl

    Protected Overrides Function availableAttribute(ByVal key As String) As Boolean
        Return attributesCollection.common(key) OrElse _
                attributesCollection.disabled(key) OrElse _
                attributesCollection.label(key)
    End Function

    Public Sub New(Optional ByVal buff As Stream = Nothing)
        MyBase.New(buff, "optgroup")
    End Sub
End Class
